package com.wuseguang.springcloud.controller;


import com.wuseguang.springcloud.Filter.RequestParameterWrapper;
import com.wuseguang.springcloud.entity.MeMoralEducationLabel;
import com.wuseguang.springcloud.service.MeMoralEducationLabelService;
import com.wuseguang.springcloud.util.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 德育项标签 前端控制器
 * </p>
 *
 * @author 
 * @since 2020-07-21
 */
@RestController
@RequestMapping("/jurisdiction")
public class MeMoralEducationLabelController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private MeMoralEducationLabelService meMoralEducationLabelServiceImpl;

    /**
     * 查询学校德育标签
     * @param request
     * @return
     */
    @RequestMapping("/findMeMoralEducationLabel")
    public Result findMeMoralEducationLabel(RequestParameterWrapper request){

        logger.info("查询学校德育标签");
        //学校id
        String schoolId = request.getParam("schoolId");
        return meMoralEducationLabelServiceImpl.findMeMoralEducationLabel(schoolId);
    }

    /**
     * 添加学校德育标签
     * @param request
     * @param meMoralEducationLabel 德育标签
     * @return
     */
    @RequestMapping("/addMeMoralEducationLabel")
    public Result addMeMoralEducationLabel(RequestParameterWrapper request, MeMoralEducationLabel meMoralEducationLabel){
        logger.info("添加学校德育标签");
        //学校id
        String schoolId = request.getParam("schoolId");
        //教师id
        String teacherId = request.getParam("teacherId");
        meMoralEducationLabel.setSchoolId(Integer.valueOf(schoolId));
        meMoralEducationLabel.setTeacherId(Integer.valueOf(teacherId));
        return meMoralEducationLabelServiceImpl.addMeMoralEducationLabel(meMoralEducationLabel);
    }

    /**
     * 删除学校德育标签
     * @param request
     * @param id 德育标签id
     * @return
     */
    @RequestMapping("/deleteMeMoralEducationLabel")
    public Result deleteMeMoralEducationLabel(RequestParameterWrapper request, @RequestParam(value = "id") Integer id){
        logger.info("删除学校德育标签");
        return meMoralEducationLabelServiceImpl.deleteMeMoralEducationLabel(id);
    }
}

